home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 715 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. From: sdouglas@armltd.co.uk (scott douglass)
  2. Message-ID: <sdouglas-1403961511440001@193.131.176.202>
  3. X-Original-Date: Thu, 14 Mar 1996 15:11:44 +0000
  4. Path: in1.uu.net!bounce-back
  5. Date: 14 Mar 96 16:17:59 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Newsgroups: comp.std.c++
  8. Subject: No way to define some extern consts?
  9. Organization: Apple Computer, Inc.
  10. X-Newsreader: Yet Another NewsWatcher 2.0.2
  11. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  12.  
  13. Hello all,
  14.  
  15. Given a class type with only a no-argument contstrutor:
  16.  
  17. struct T { T(); /* ... */ };  // assume no other ctors
  18.  
  19. Is there any way to define an extern const object of class T?
  20.  
  21. extern const T t; // nope:  this is a declaration
  22. const T t2; // nope:  this is a definition, but t2 is not extern
  23. extern const T t3();  // nope:  this is a declaration of the function
  24. named t3 which returns a const T
  25.  
  26. So, can you find a way to *define* an extern const object type T? 
  27. (Besides adding some ctor with a dummy argument.)  If you can you9re
  28. smarter than I am.
  29.  
  30. Thanks,
  31.     --scott
  32. ---
  33. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  34. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  35. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  36. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  37. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  38.